
--[[
	**********************
	* SvFrame - thomasfn *
	**********************
	weather.lua - Loads basic time functionality
]]

function PLUGIN:InitWeather()
	svr.AddFlag( "weather" )
	
	self:Command( "rain", self.Rain, { FLAG_WEATHER }  )
end

table.insert( PLUGIN.Inits, PLUGIN.InitWeather )

function PLUGIN:Rain( ply, args )
	if (not svr.CheckArg( args, 1, "string")) then return ply:ChatPrint( colour.White, "Syntax: /rain <on/off> [storm]" ) end
	
	local Rain = args[1] ~= "off"
	local world = server.GetWorld(0)

	if (Rain) then
		svr.ChatPrint( nil, ply:Name(), " has set rain to ", colour.Green, "on." )
	else
		svr.ChatPrint( nil, ply:Name(), " has set rain to ", colour.Red, "off." )
	end
	world.Raining(Rain)
	
	if (svr.CheckArg( args, 2, "bool")) then
		local Storm = args[2] ~= "off"
		world.Storming(Storm)
	end
end